//
// Created by wk on 2024/1/2.
//

#include "EncryptOther.h"

EncryptOther::EncryptOther() {

}

EncryptOther::~EncryptOther() {

}

bool EncryptOther::isEncryptType(FILE *inputFile) {

    fseek(inputFile, 0, SEEK_SET);
    char buf[16] = {0};
    int ret = fread(buf, 1, sizeof(buf), inputFile);
    if (ret != sizeof(buf)) {
        return false;
    }

    switch (*((int32_t *) &buf[0])) {
        case 0x0e0d0a08:/*MP4加密*/
        case 0x5269bc73:/*MOV加密*/
            mEncryptType = EncryptType_FET_MOV;
            return true;
        case 0x653c3a3a:/*MP4加密*/
        case (long)0x9d9d9254:
            mEncryptType = EncryptType_OLD_MPEG;
            return true;
    }
    return false;
}
